import request from '@/utils/request'

export const createCardApi = (data) => {
  return request.post('/parking/card',
    data
  )
}

/**
 * 获取月卡详情
 * @data
 * @returns
 */
export function getCardDetailAPI(id) {
  return request({
    url: `/parking/card/detail/${id}`
  })
}

/**
 * 更新月卡
 * @param {*} data
 * @returns
 */
export function updateCardAPI(data) {
  return request({
    url: '/parking/card/edit',
    method: 'PUT',
    data
  })
}

export const recharge = ({ cardStartDate, cardEndDate, paymentAmount, paymentMethod, carInfoId }) => {
  return request.post('/parking/card/recharge',
    { cardStartDate, cardEndDate, paymentAmount, paymentMethod, carInfoId }
  )
}
